home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
web
/
noweb
/
src
/
c
/
match.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-24
|
677b
|
21 lines
#line 10 "match.nw"
#include <string.h>
#include "match.h"
static int matches(char *line, char *search) {
return !strncmp(line,search,strlen(search));
}
int is_keyword(char *line, char *keyword) {
char low_at_sign = '@';
return *line==low_at_sign && matches(line+1,keyword) &&
(line[strlen(keyword)+1]==' ' || line[strlen(keyword)+1]=='\n');
}
int is_begin(char *line, char *type) {
return is_keyword(line,"begin") && matches(line+1+6,type);
}
int is_end(char *line, char *type) {
return is_keyword(line,"end") && matches (line+1+4,type);
}
int is_index(char *line, char *type) {
return is_keyword(line,"index") && matches(line+1+6,type);
}